package com.koocloud.electroplatemanage.controller;

import com.koocloud.electroplatemanage.common.pojo.ResponseTemplate;
import com.koocloud.electroplatemanage.service.StatisticalFormService;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: Information_platform
 * @description: 统计报表
 * @author: xxc
 * @create: 2020-10-21 12:21
 */
@RestController
@RequestMapping("/statisticalform")
public class StatisticalFormController {
    static Logger log = Logger.getLogger("statisticalform");
    @Autowired
    StatisticalFormService statisticalFormService;

    /**
     *@Description: 整体按月完成情况
     *@Param: [year]
     *@return: com.koocloud.electroplatemanage.common.pojo.ResponseTemplate
     *@Author: xxc
     *@date: 2020/10/21
     */
    @RequestMapping(value = "/selectAllByMonthStatus", method = RequestMethod.POST, name = "整体按月完成情况")
    public ResponseTemplate selectAllByMonthStatus(String year){

        return statisticalFormService.selectAllByMonthStatus(year);
    }
    /**
     *@Description: 个人按月完成项数
     *@Param: [year]
     *@return: com.koocloud.electroplatemanage.common.pojo.ResponseTemplate
     *@Author: xxc
     *@date: 2020/10/21
     */

    @RequestMapping(value = "/selectByMonthPersonTerms", method = RequestMethod.POST, name = "个人按月完成项数")
    public ResponseTemplate selectByMonthPersonTerms(@RequestParam(value = "year")String year, @RequestParam(value = "page") String page, @RequestParam(value = "limit") String limit){
        //分页参数为空则赋值0
        if (!StringUtils.isNotEmpty(page)) {
            page = "0";
        }
        if (!StringUtils.isNotEmpty(limit)) {
            limit = "0";
        }
        return statisticalFormService.selectByMonthPersonTerms(year,page,limit);
    }
    /**
     *@Description: 个人按月完成数量
     *@Param: [year]
     *@return: com.koocloud.electroplatemanage.common.pojo.ResponseTemplate
     *@Author: xxc
     *@date: 2020/10/21
     */
    @RequestMapping(value = "/selectByMonthPersonNums", method = RequestMethod.POST, name = "个人按月完成数量")
    public ResponseTemplate selectByMonthPersonNums(@RequestParam(value = "year")String year, @RequestParam(value = "page") String page, @RequestParam(value = "limit") String limit){
        //分页参数为空则赋值0
        if (!StringUtils.isNotEmpty(page)) {
            page = "0";
        }
        if (!StringUtils.isNotEmpty(limit)) {
            limit = "0";
        }
        return statisticalFormService.selectByMonthPersonNums(year,page,limit);
    }
    /**
     *@Description: 个人按月完成含税总价
     *@Param: [year]
     *@return: com.koocloud.electroplatemanage.common.pojo.ResponseTemplate
     *@Author: xxc
     *@date: 2020/10/21
     */
    @RequestMapping(value = "/selectByMonthPersonTotalPrice", method = RequestMethod.POST, name = "个人按月完成含税总价")
    public ResponseTemplate selectByMonthPersonTotalPrice(@RequestParam(value = "year")String year, @RequestParam(value = "page") String page, @RequestParam(value = "limit") String limit){
        //分页参数为空则赋值0
        if (!StringUtils.isNotEmpty(page)) {
            page = "0";
        }
        if (!StringUtils.isNotEmpty(limit)) {
            limit = "0";
        }
        return statisticalFormService.selectByMonthPersonTotalPrice(year,page,limit);
    }

    /**
     *@Description: 个人按月完成总工时
     *@Param: [year]
     *@return: com.koocloud.electroplatemanage.common.pojo.ResponseTemplate
     *@Author: xxc
     *@date: 2020/10/21
     */
    @RequestMapping(value = "/selectByMonthPersonTotalHours", method = RequestMethod.POST, name = "个人按月完成总工时")
    public ResponseTemplate selectByMonthPersonTotalHours(@RequestParam(value = "year")String year, @RequestParam(value = "page") String page, @RequestParam(value = "limit") String limit){
        //分页参数为空则赋值0
        if (!StringUtils.isNotEmpty(page)) {
            page = "0";
        }
        if (!StringUtils.isNotEmpty(limit)) {
            limit = "0";
        }
        return statisticalFormService.selectByMonthPersonTotalHours(year,page,limit);
    }
    /**
     *@Description: 单月完成情况
     *@Param: [year]
     *@return: com.koocloud.electroplatemanage.common.pojo.ResponseTemplate
     *@Author: xxc
     *@date: 2020/10/21
     */
    @RequestMapping(value = "/selectMonthStatus", method = RequestMethod.POST, name = "单月完成情况")
    public ResponseTemplate selectByMonthStatus( @RequestParam(value = "page") String page, @RequestParam(value = "limit") String limit,@RequestParam(value = "year")String year,@RequestParam(value = "month")String month){
        //分页参数为空则赋值0
        if (!StringUtils.isNotEmpty(page)) {
            page = "0";
        }
        if (!StringUtils.isNotEmpty(limit)) {
            limit = "0";
        }
        return statisticalFormService.selectByMonthStatus(page,limit,year,month);
    }



}
